package com.example.springbootdemo.controller.ExceptionDemo.config;

import com.example.springbootdemo.controller.ExceptionDemo.vo.ExceptionDemoVo;
import org.apache.catalina.connector.ClientAbortException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;

@ControllerAdvice("com.example.springbootdemo.controller.ExceptionDemo")
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {

    public void test(){
        System.out.println("invoke-----");
    }

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public ExceptionDemoVo handleException(Exception exception) {
        System.out.println("");

        return new ExceptionDemoVo("exception");
    }


}
